home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / utilities / mui / developer / extclasses / mcc_busy / source / show_busy.c < prev   
Encoding:
C/C++ Source or Header  |  1994-08-07  |  2.6 KB  |  116 lines

  1. /*
  2.  
  3.         Busy.mcc (c) 1994 by kmel, Klaus Melchior
  4.  
  5.         Example for Busy.mcc
  6.  
  7.         show_busy.c
  8.  
  9. */
  10.  
  11. /* DMAKE */
  12.  
  13.  
  14. /*** includes ***/
  15. #include <demo.h>
  16. #include <mui/busy_mcc.h>
  17.  
  18. /*** defines ***/
  19. #define DEFAULT_COLOR1   1
  20. #define DEFAULT_COLOR2   2
  21. #define DEFAULT_SIZE     8
  22.  
  23. /*** externals ***/
  24. extern char *vers_tag;
  25.  
  26. /*** main ***/
  27. int main(int argc,char *argv[])
  28. {
  29.     APTR app;
  30.     APTR window;
  31.     APTR bt_move, by_move;
  32.     APTR sl_color1, sl_color2, sl_size;
  33.  
  34.     ULONG signals;
  35.     BOOL running = TRUE;
  36.  
  37.     app = ApplicationObject,
  38.         MUIA_Application_Title      , "Show_BusyClass",
  39.         MUIA_Application_Version    , vers_tag + 6,
  40.         MUIA_Application_Copyright  , "©1994, kMel Klaus Melchior",
  41.         MUIA_Application_Author     , "Klaus Melchior",
  42.         MUIA_Application_Description, "Demonstrates the busy class.",
  43.         MUIA_Application_Base       , "SHOWBUSY",
  44.  
  45.         SubWindow, window = WindowObject,
  46.             MUIA_Window_Title, "BusyClass",
  47.             MUIA_Window_ID   , MAKE_ID('B','U','S','Y'),
  48.             WindowContents, VGroup,
  49.  
  50.                 /*** create a busy bar with a gaugeframe ***/
  51.                 Child, by_move = BusyBar,
  52.                 Child, bt_move = KeyButton("Move ...", 'm'),
  53.  
  54.                 Child, ColGroup(2),
  55.                     Child, KeyLabel2("Color 1 :", '1'),
  56.                     Child, sl_color1 = KeySlider(0, 7, DEFAULT_COLOR1, '1'),
  57.                     Child, KeyLabel2("Color 2 :", '2'),
  58.                     Child, sl_color2 = KeySlider(0, 7, DEFAULT_COLOR2, '2'),
  59.                     Child, KeyLabel2("Size :", 's'),
  60.                     Child, sl_size = KeySlider(4, 20, DEFAULT_SIZE, 's'),
  61.                     End,
  62.  
  63.                 End,
  64.  
  65.             End,
  66.         End;
  67.  
  68.     if (!app)
  69.         fail(app,"Failed to create Application.");
  70.  
  71.     /*** generate notifies ***/
  72.     DoMethod(window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
  73.         app, 2,
  74.         MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
  75.  
  76.     DoMethod(bt_move, MUIM_Notify, MUIA_Timer, MUIV_EveryTime,
  77.         by_move, 2,
  78.         MUIM_Busy_Move, TRUE);
  79.  
  80.     DoMethod(sl_color1,    MUIM_Notify, MUIA_Slider_Level, MUIV_EveryTime,
  81.         by_move, 3,
  82.         MUIM_Set, MUIA_Busy_Color1, MUIV_TriggerValue);
  83.  
  84.     DoMethod(sl_color2, MUIM_Notify, MUIA_Slider_Level, MUIV_EveryTime,
  85.         by_move, 3,
  86.         MUIM_Set, MUIA_Busy_Color2, MUIV_TriggerValue);
  87.  
  88.     DoMethod(sl_size, MUIM_Notify, MUIA_Slider_Level, MUIV_EveryTime,
  89.         by_move, 3,
  90.         MUIM_Set, MUIA_Busy_Size, MUIV_TriggerValue);
  91.  
  92.     /*** ready to open the window ... ***/
  93.     set(window,MUIA_Window_Open,TRUE);
  94.  
  95.     while (running)
  96.     {
  97.         switch (DoMethod(app,MUIM_Application_Input,&signals))
  98.         {
  99.             case MUIV_Application_ReturnID_Quit:
  100.                 running = FALSE;
  101.                 break;
  102.         }
  103.  
  104.         if (running && signals)
  105.             Wait(signals);
  106.     }
  107.  
  108.     set(window, MUIA_Window_Open, FALSE);
  109.  
  110.  
  111.     /*** shutdown ***/
  112.     MUI_DisposeObject(app);      /* dispose all objects. */
  113.     fail(NULL,NULL);             /* exit, app is already disposed. */
  114. }
  115.  
  116.